package ar.com.fiuba.ElectronicCircuitAnalyst.application.api;

import ar.com.fiuba.ElectronicCircuitAnalyst.application.api.dto.ComponentDto;
import ar.com.fiuba.ElectronicCircuitAnalyst.domain.exceptions.AlreadyExistingCircuitElementException;
import ar.com.fiuba.ElectronicCircuitAnalyst.domain.exceptions.CircuitElementNotFoundException;
import ar.com.fiuba.ElectronicCircuitAnalyst.domain.exceptions.InvalidCircuitElementException;

/**
 * Interface for a service that provides operations over circuit components. It
 * works basically as a CRUD for components.
 * 
 */
public interface ComponentService {

	/**
	 * Method to build a component out of input data.
	 * 
	 * @param data
	 *            the DTO filled with the information for the component to be
	 *            created.
	 * @throws InvalidCircuitElementException
	 *             if there's any inconcistencies with the parameters.
	 * @throws AlreadyExistingCircuitElementException
	 *             if there's component with the same name exists.
	 */
	public void makeComponent(ComponentDto data) throws InvalidCircuitElementException,
			AlreadyExistingCircuitElementException;

	/**
	 * Method to modify component's properties.
	 * 
	 * @param data
	 *            the DTO filled with the new information for the component to
	 *            be created. This holds the name of the component to be
	 *            modified.
	 * @throws InvalidCircuitElementException
	 *             if there's any inconcistencies with the new parameters.
	 * @throws CircuitElementNotFoundException
	 *             if no circuit with such name is found.
	 */
	public void modifyComponent(ComponentDto data) throws InvalidCircuitElementException,
			CircuitElementNotFoundException;

	/**
	 * Method to eliminate a component.
	 * 
	 * @param name
	 *            the name of the component to be removed.
	 * @throws CircuitElementNotFoundException
	 *             if no component with such name is found.
	 * @throws InvalidCircuitElementException
	 *             if there's an error reaching the component.
	 */
	public void removeComponent(String name) throws CircuitElementNotFoundException, InvalidCircuitElementException;

}
